package com.stylefeng.guns.modular.flagglory.warpper;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.stylefeng.guns.common.persistence.dao.DepartmentMapper;
import com.stylefeng.guns.common.persistence.dao.QuestionCategoryMapper;
import com.stylefeng.guns.common.persistence.model.Department;
import com.stylefeng.guns.common.persistence.model.QuestionCategory;
import com.stylefeng.guns.core.base.warpper.BaseControllerWarpper;
import com.stylefeng.guns.core.util.SpringContextHolder;
import com.stylefeng.guns.modular.flagglory.dao.DepartmentDao;

import java.util.Map;

/**
 * 部门列表的包装
 *
 * @author fengshuonan
 * @date 2017年4月25日 18:10:31
 */
public class DepartmentWarpper extends BaseControllerWarpper {
    private DepartmentMapper departmentMapper = SpringContextHolder.getBean(DepartmentMapper.class);

    public DepartmentWarpper(Object list) {
        super(list);
    }


    @Override
    public void warpTheMap(Map<String, Object> map) {
        Integer pid = (Integer) map.get("pid");
        Department department = departmentMapper.selectById(pid);
        if (null != department) {
            map.put("pName", department.getFullname());
        } else {
            map.put("pName", "无");
        }

    }

}
